package com.example.paper.interceptor;


import java.io.IOException;
import java.util.Iterator;

import okhttp3.Interceptor;
import okhttp3.MediaType;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okio.Buffer;

public class FTokenInterceptor implements Interceptor {
    @Override
    public Response intercept(Chain chain) throws IOException {
        //先获取原有request
        Request request = chain.request();
        //配置添加过token的request
        Request.Builder builder = new Request.Builder();
        builder.url(request.url());
        builder.headers(request.headers());
        builder.header("token", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIzNTgyNDAwNTExMTExMTAiLCJleHAiOjMyNDI0OTMwODksImlhdCI6MTYyMTI0NjU0NH0.twnUwHY0OJ0ybMNF-apnnaqfqYrEy1aKoF9UwdVdP6Q");
        builder.post(request.body());
        Request build = builder.build();
        return chain.proceed(build);
    }

}
